<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * Class WechatMenu
 *
 * @mixin \Eloquent
 */
class WechatMenu extends \Baum\Node
{
    protected $table = 'pw_wechat_menu';

    public $timestamps = false;

    // 'parent_id' column name
    protected $parentColumn = 'parent_id';

    // 'lft' column name
    protected $leftColumn = 'lidx';

    //protected $orderColumn = "orderby";

    // 'rgt' column name
    protected $rightColumn = 'ridx';

    // 'depth' column name
    protected $depthColumn = 'depth';

    // guard attributes from mass-assignment
    protected $guarded = array('id', 'parent_id', 'lidx', 'ridx', 'depth');


    protected $fillable = [
        'parentid',
        'name',
        'typecode',
        'keyword',
        'value',
        'url',
        'redirect_url',
        'event',
        'telephone',
        'location',
        'orderby',
        'mod'
    ];

    public function getTypeNameAttribute()
    {
        return isset($this->menuTypeList[$this->typecode])?$this->menuTypeList[$this->typecode]:"";
    }

    public $menuTypeList = [
        //"click"=>"点击推事件",
        "view"=>"url链接菜单",
        //"scancode_push"=>"扫码推事件",
        //"scancode_waitmsg"=>"扫码推事件且弹出“消息接收中”提示框",
        //"pic_sysphoto"=>"弹出系统拍照发图",
        //"pic_photo_or_album"=>"弹出拍照或者相册发图",
        //"pic_weixin"=>"弹出微信相册发图器",
        //"location_select"=>"弹出地理位置选择器",
        //"media_id"=>"下发消息（除文本消息）",
        //"view_limited" => "跳转图文消息",
    ];

        
}